import request from "../utils/request";
import instance from "../utils/request";


export interface ResponseData {
    // code?:string
    // msg?:string
    data:any
}
export const reportList = () =>
    request.post<any, ResponseData>( "/user/reportList")


export  class userService{
    static async login(loginForm:object){
        return  instance({
            url:"/user/login",
            method:"POST",
            data:JSON.stringify(loginForm)
        })
    }

    //获取医生个人信息（向后端传递的参数jobNum）
    static async info(jobNum:string){
        return  instance({
            url:`/user/info/${jobNum}`,
            method:"GET",
        })
    }
    //更新医生个人信息
    static async updateInfo(doctorInfo:object){
        return  instance({
            url:"/user/updateInfo",
            method:"POST",
            data:JSON.stringify(doctorInfo)
        })
    }

    //获取病例数和危急值数
    static async getCount(){
        return instance({
            url:"http://127.0.0.1:8080/user/hazard/getCount",
            method:"POST",
        })
    }
    //获取危急值列表
    static async getHazard(){
        return instance({
            url:"http://127.0.0.1:8080/user/hazard/getHazard",
            method:"POST",
        })
    }
    //获取传染病
    static async infectious(){
        return instance({
            url:"http://127.0.0.1:8080/user/hazard/infectious",
            method:"POST",
        })
    }

    //诊断界面（获取患者信息）
    static async getPatient(doctor_id:BigInt){
        return instance({
            url:`/user/getPatient/${doctor_id}`,
            method:"GET",
        })
    }
    //诊断界面（获取患者影像）
    static async getImage(patientId:BigInt){
        return  instance({
            url:"http://127.0.0.1:8080/image/getImage",
            method:"POST",
            data:JSON.stringify(patientId)
        })
    }
    //诊断界面（提交传染病报告）
    static async createInfectious(infectForm:object) {
        return instance({
            url: "/user/createInfectious",
            method: "POST",
            data: JSON.stringify(infectForm)
        })
    }
    //诊断界面（提交危急值报告）
    static async submitHazard(hazardForm: object) {
        return instance({
            url: "/user/submitHazard",
            method: "POST",
            data: JSON.stringify(hazardForm)
        })
    }
    //诊断界面（提交危急值报告）
    static async submitReport(diagnoseForm: object) {
        return instance({
            url: "/user/submitReport",
            method: "POST",
            data: JSON.stringify(diagnoseForm)
        })
    }

    //获取诊断报告记录
    // static async reportList() {
    //     return instance({
    //         url: "/user/reportList",
    //         method: "POST",
    //     })
    // }



    //根据报告号 获取患者的报告
    static async getDiseaseInfo(reportNo:BigInt){
        return instance({
            url: "/user/getDiseaseInfo",
            method: "POST",
            data: JSON.stringify(reportNo)
        })
    }
    //根据报告 获取影像
    static async getReportImage(reportNo:BigInt){
        return instance({
            url: "/user/getImage",
            method: "POST",
            data: JSON.stringify(reportNo)
        })
    }
    //订正报告
    static async updateReport(display:object){
        return instance({
            url: "/user/updateReport",
            method: "POST",
            data: JSON.stringify(display)
        })
    }

    //获取通知标题
    static async getTitle() {
        return instance({
            url: "/user/getTitle",
            method: "POST",
        })
    }
    //获取通知内容
    static async getContent(title:string) {
        return instance({
            url: `/user/getContent/${title}`,
            method: "GET",
        })
    }
}